<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('navigation_update'); ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>修改后台菜单</title>
<link rel="stylesheet" href="../plugin/iconfont/iconfont.css">
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/laymain.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript" src="templates/js/getuploadify.js"></script>
<script type="text/javascript">
$(function () {
    //初始化表单验证
    $("#form").initValidform();
});
function GetRbac(id)
{
	var checkbox = document.getElementById(id);//
		if(checkbox.checked){
			
			$("#cblActionType").show();
	  }else{
		$("#cblActionType").hide()
	  }
}
</script>
</head>
<body class="mainbody">
<?php
$row = $dosql->GetOne("SELECT * FROM `#@__navigation` WHERE `id`=$id");
?>
<form method="post" action="navigation_save.php" id="form">
<!--导航栏-->
<div class="location">
  <a href="navigation.php" class="back"><i></i><span>返回列表页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <a href="navigation.php"><span>菜单列表</span></a>
  <i class="arrow"></i>
  <span>修改后台菜单</span>
    <a href="javascript:location.reload();" class="reload">刷新</a>
</div>
<div class="line10"></div>
<!--/导航栏-->

<!--内容-->
<div id="floatHead" class="content-tab-wrap">
  <div class="content-tab">
    <div class="content-tab-ul-wrap">
      <ul>
        <li><a class="selected" href="javascript:;">基本信息</a></li>
      </ul>
    </div>
  </div>
</div>

<div class="tab-content">
   <dl>
    <dt>上级菜单</dt>
    <dd>
      <div class="rule-single-select">
        <select name="parentid" id="parentid">
			<option value="0">一级导航分类</option>
			<?php GetAllType('#@__navigation','#@__navigation','parentid'); ?>
		</select>
      </div>
    </dd>
  </dl>
  <dl>
    <dt>排序数字</dt>
    <dd>
      <input name="orderid" type="text" value="<?php echo $row['orderid']; ?>"id="orderid" class="input small" datatype="n" sucmsg=" " />
      <span class="Validform_checktip">*数字，越小越向前</span>
    </dd>
  </dl>
  <dl>
    <dt>是否隐藏</dt>
    <dd>
      <div class="rule-single-checkbox">
          <input id="checkinfo" type="checkbox" value="true" name="checkinfo" <?php if($row['checkinfo'] != 'false') echo 'checked="checked"'; ?>  />
      </div>
      <span class="Validform_checktip">*隐藏后不显示在界面导航菜单中。</span>
    </dd>
  </dl>
  <dl>
    <dt>调用别名</dt>
    <dd>
      <input name="idname" type="text" id="idname"   class="input" value="<?php echo $row['idname']; ?>" datatype="/^[a-zA-Z0-9\-\_]{2,50}$/" errormsg="请填写正确的ID" sucmsg="可以使用" ajaxurl="ajax_do.php?action=navigation&old_name=<?php echo $row['idname']; ?>" />
      <span class="Validform_checktip">权限控制名称，只允许字母、数字、下划线</span>
    </dd>
  </dl>
  <dl>
    <dt>菜单标题</dt>
    <dd><input name="classname" type="text"  value="<?php echo $row['classname']; ?>" id="classname" class="input normal" datatype="*1-100" sucmsg=" " /> <span class="Validform_checktip">*导航中文标题，30字符内</span></dd>
  </dl>
  <dl>
    <dt>自定义图标</dt>
    <dd>
      <input name="picurl" type="text" maxlength="255" id="picurl" value="<?php echo $row['picurl'];?>"  class="input" />
	<span class="Validform_checktip"><i class="iconfont <?php echo $row['picurl'];?>"> </i><span class="Validform_checktip">请输入iconfont字体样式 例如：icon-shezhi</i></span></span>
    </dd>
  </dl>
  <dl>
    <dt>链接地址</dt>
    <dd>
      <input name="linkurl" type="text" maxlength="255" value="<?php echo $row['linkurl']; ?>" id="linkurl" class="input normal upload-path" />
      <span class="Validform_checktip">当前管理目录，有子导航不用填</span>
    </dd>
  </dl>
  <dl>
    <dt>备注说明</dt>
    <dd>
     <textarea name="remark" rows="2" cols="20" id="remark" value="<?php echo $row['remark']; ?>"  class="input">
	</textarea>
      <span class="Validform_checktip">非必填，可为空</span>
    </dd>
  </dl>
    <dl>
    <dt>参与RBAC</dt>
    <dd>
      <div class="rule-single-checkbox">
          <input id="RBAC" type="checkbox" name="RBAC" value="true" onclick="GetRbac('RBAC');" <?php if($row['RBAC'] == 'true') echo 'checked="checked"'; ?> />
      </div>
      <span class="Validform_checktip">*是否参与角色权限控制。选“否”权限分配列表此菜单和子菜单都不显示</span>
    </dd>
  </dl>
   <div id="cblActionType" class="undis" style="<?php if($row['RBAC'] == 'true') echo 'display:block;';?>">
  <dl>
    <dt>权限资源</dt>
    <dd>
      <div class="rule-multi-porp">
          <span id="cblActionType">
		  
			<?php 
		$action_type = explode(',',$row['action_type']);
		require_once(ADMIN_INC.'/actionType.php');
 
		  	foreach($actionType as $i => $value)
		{		
				echo '<input id="action_type[]'.$i.'"';
				
			if(in_array($i,$action_type))
				{
					echo 'checked="checked"';
				}
			echo 'type="checkbox" name="action_type[]" value="'.$i.'" /><label for="action_type[]'.$i.'">'.$value.'</label>';
		}
		
		  ?>
		  </span>
      </div>
    </dd>
  </dl>
</div>
</div>
<!--/内容-->

<!--工具栏-->
<div class="page-footer">
  <div class="btn-wrap">
    <input type="submit" name="btnSubmit" value="提交保存" id="btnSubmit" class="btn" />
    <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript:history.back(-1);" />
	<input type="hidden" name="action" id="action" value="update" />
		<input type="hidden" name="id" id="id" value="<?php echo $id; ?>" />
		<input type="hidden" name="repid" id="repid" value="<?php echo $row['parentid']; ?>" />
  </div>
</div>
<!--/工具栏-->
</form>
</body>
</html>
